home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Python 1.3.3 / Python 133 SRC / Mac / Modules / menu / menuscan.py < prev    next >
Text File  |  1996-04-12  |  1KB  |  57 lines

  1. # Scan <Menus.h>, generating menugen.py.
  2. import addpack
  3. addpack.addpack(':Tools:bgen:bgen')
  4.  
  5. from scantools import Scanner
  6. from bgenlocations import TOOLBOXDIR
  7.  
  8. def main():
  9.     input = "Menus.h"
  10.     output = "menugen.py"
  11.     defsoutput = TOOLBOXDIR + "Menus.py"
  12.     scanner = MyScanner(input, output, defsoutput)
  13.     scanner.scan()
  14.     scanner.close()
  15.     print "=== Done scanning and generating, now doing 'import menusupport' ==="
  16.     import menusupport
  17.     print "=== Done.  It's up to you to compile Menumodule.c ==="
  18.  
  19. class MyScanner(Scanner):
  20.  
  21.     def destination(self, type, name, arglist):
  22.         classname = "Function"
  23.         listname = "functions"
  24.         if arglist:
  25.             t, n, m = arglist[0]
  26.             if t in ("MenuHandle", "MenuRef") and m == "InMode":
  27.                 classname = "Method"
  28.                 listname = "methods"
  29.         return classname, listname
  30.  
  31.     def makeblacklistnames(self):
  32.         return [
  33.             ]
  34.  
  35.     def makeblacklisttypes(self):
  36.         return [
  37.             'MCTableHandle',
  38.             'MCEntryPtr',
  39.             'MCTablePtr',
  40.             ]
  41.  
  42.     def makerepairinstructions(self):
  43.         return [
  44.             ([("Str255", "itemString", "InMode")],
  45.              [("*", "*", "OutMode")]),
  46.             
  47.             ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
  48.              [("InBuffer", "*", "*")]),
  49.             
  50.             ([("void", "*", "OutMode"), ("long", "*", "InMode"),
  51.                                         ("long", "*", "OutMode")],
  52.              [("VarVarOutBuffer", "*", "InOutMode")]),
  53.             ]
  54.  
  55. if __name__ == "__main__":
  56.     main()
  57.